/**
 * Created with IntelliJ IDEA
 * Description:
 * User: Administrator
 * Data: 2023 - 04 - 17
 * Time: 22:28
 */
//求数组的平均值
public class test2 {
    public static double avg(int[] arr1) {
        double sum = 0;
        for (int i = 0; i < arr1.length; i++) {
            sum += arr1[i];
        }
        return sum / arr1.length;
    }
    public static void main(String[] args) {
          int[] arr1 = {1, 2, 3, 4, 7};
          double average = avg(arr1);
        System.out.println(average);
    }
}
